-
Notifications
You must be signed in to change notification settings - Fork 62
fix: 'closed' filter behavior in PR section #200
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: 'closed' filter behavior in PR section #200
Conversation
✅ Deploy Preview for github-spy ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
WalkthroughUpdated Tracker.tsx filterData to explicitly branch filterType into open, closed, and merged, making categories disjoint. Closed now excludes merged by checking closed state without merged_at. Other filters (title search, repository, start/end dates) are unchanged. Changes
Sequence Diagram(s)sequenceDiagram
participant UI as Tracker UI
participant Filter as filterData
participant Item as PR Item
UI->>Filter: Apply filters (filterType, search, repo, dates)
alt filterType == "merged"
Filter->>Item: include if !!pull_request?.merged_at
else filterType == "closed"
Filter->>Item: include if state==="closed" && !pull_request?.merged_at
else filterType == "open"
Filter->>Item: include if state==="open"
end
Note over Filter: Then apply searchTitle, repository, startDate, endDate
Filter-->>UI: Return filtered list
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Assessment against linked issues
Poem
Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. ✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉 Thank you @Srijatalamarla for your contribution. Please make sure your PR follows https://github.com/GitMetricsLab/github_tracker/blob/main/CONTRIBUTING.md#-pull-request-guidelines
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
src/pages/Tracker/Tracker.tsx (2)
104-115: Make filtering more explicit and robust; also verify data source populates merged_at.Some GitHub endpoints don’t include pull_request.merged_at unless you fetch PR details. If merged_at is missing, “merged” will show empty. Refactor to a switch and keep semantics unchanged.
Apply within this range:
- filtered = filtered.filter((item) => { - if (filterType === "merged") { - return !!item.pull_request?.merged_at - } - else if (filterType === "closed") { - return item.state === "closed" && !item.pull_request?.merged_at - } - else { - //open - return item.state === "open" - } - }); + filtered = filtered.filter((item) => { + switch (filterType) { + case "merged": + return Boolean(item.pull_request?.merged_at); + case "closed": + return item.state === "closed" && !item.pull_request?.merged_at; + case "open": + return item.state === "open"; + default: + return true; + } + });Optionally, narrow the filter type to prevent invalid values elsewhere:
type StateFilter = "all" | "open" | "closed" | "merged";To verify data shape, please confirm your fetch layer sets pull_request.merged_at for PRs (e.g., GraphQL or pulls.get). If you want, I can generate a script to scan the repo for where merged_at is sourced.
81-87: Effect dependencies don’t match the comment; either include username (and fetchData) or fix the comment.As written, the effect won’t re-fetch on username change. If that’s intended, update the comment. If not, include deps.
- // Fetch data when username, tab, or page changes - useEffect(() => { + // Fetch data when username, tab, or page changes + useEffect(() => { if (username) { fetchData(username, page + 1, ROWS_PER_PAGE); } - }, [tab, page]); + }, [username, tab, page, fetchData]);If fetchData isn’t stable, wrap it with useCallback in the hook or suppress the dep intentionally and update the comment to avoid confusion.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
src/pages/Tracker/Tracker.tsx(1 hunks)
🔇 Additional comments (1)
src/pages/Tracker/Tracker.tsx (1)
104-115: Closed filter now correctly excludes merged PRs — aligns with #166.Logic makes “merged”, “closed (not merged)”, and “open” disjoint. Good fix.
|
🎉🎉 Thank you for your contribution! Your PR #200 has been merged! 🎉🎉 |
Related Issue
Description
Updated the pull request filtering logic to ensure that closed only includes PRs that are closed but not merged,
and merged only includes PRs that have been merged.
Screenshots
Type of Change
Summary by CodeRabbit